package com.example.day09;

import com.example.day10.DBCPDatasource;
import com.mysql.jdbc.Driver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Transaction {
    public static void main(String[] args) throws SQLException {
        new Driver();
        Connection connection = DBCPDatasource.getConnection();
        connection.setAutoCommit(false); //
        String sql = "DELETE FROM db_test.student";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.executeUpdate();
        connection.commit();
    }
}
